////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                           BailterRay                                       //
//                    Pip Robbins & Zhao Zhang                                //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
class BailterRayQuickDodge extends BailterRayPickupFactory
                placeable;

var() float Value;
var BailterRayHUD MyHud;
var BailterRayPlayerController PC;

function SpawnCopyFor( Pawn Recipient )
{

	if ( UTPawn(Recipient) == None )
		return;

	Recipient.MakeNoise(0.2);
	 ChangeDodge(UTPawn(Recipient));
	if(MyHud != none)
	{
	    MyHud.PickupTextureType = 0;
        MyHud.bShowPickupDes = true;
        setTimer(3,false,'DisableDescription') ;
    }
	super.SpawnCopyFor(Recipient);

}

function DisableDescription()
{
    if(MyHud != none)
    {
        MyHud.bShowPickupDes = false;
        //MyHud.PickupDesCounter[0]++;
    }
}

function ChangeDodge(UTPawn P)
{
    if(P != none)
    {
        PC = BailterRayPlayerController(P.Controller);
        if(PC != none)
            MyHud = BailterRayHUD(PC.myHUD);
    }
    if(PC != none && MyHud != none)
    {
        PC.DodgeTimeLimit = 2;
        MyHud.DodgeTimeLimit = 0.68;
        MyHud.DodgeTimeRemaining = 0.68;
        MyHud.bQuickDodge = true;
        setTimer(60,false,'DisableQuickDodge');
    }

}

function DisableQuickDodge()
{
    if(PC != none)
    {
        MyHud.bQuickDodge = false;
        PC.DodgeTimeLimit = 10;
        MyHud.DodgeTimeLimit = 8.8;
        MyHud.DodgeTimeRemaining = 8.8;
    }
}

simulated function Respawn(Pawn P)
{
    super.Respawn(P);
    if(P == none)
    {
        DisableQuickDodge();
    }
}

defaultproperties
{
   Value=200
   PickupSound=SoundCue'BailterRaySoundPackages.PICKUPS.Pickup_SoundCue'
      Begin Object class=StaticMeshComponent Name=QuickDodgePickUpComp
      StaticMesh=StaticMesh'BailterRayAssetPackageLevel1.Powerups.Dodge_powerup'
      Scale3D=(X=1.300000,Y=1.300000,Z=1.300000)
   End Object
   PickupMesh=QuickDodgePickUpComp
   Components(6)=QuickDodgePickUpComp
   //ParticleEffectsEmitter=ParticleSystem'UN_HeroEffects.Effects.FX_HeroDetonate_Red'
   ParticleEffectsGlow=ParticleSystem'BailterRayAssetPackageLevel1.Powerups.Powerups_Spawn_Effect'
}